package com.cn.arcgisdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
import com.esri.arcgisruntime.mapping.ArcGISScene;
import com.esri.arcgisruntime.mapping.ArcGISTiledElevationSource;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.Viewpoint;
import com.esri.arcgisruntime.mapping.view.Camera;
import com.esri.arcgisruntime.mapping.view.SceneView;

public class LoadArcgisImageServer extends AppCompatActivity {

    private SceneView mSceneView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_load_arcgis_image_server);

        ArcGISScene scene = new ArcGISScene();
        scene.setBasemap(Basemap.createImagery());

        mSceneView = (SceneView) findViewById(R.id.sceneView);
        mSceneView.setAttributionTextVisible(false);
        mSceneView.setScene(scene);
        ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(
                getResources().getString(R.string.elevation_image_service));
        scene.getBaseSurface().getElevationSources().add(elevationSource);

        Camera camera = new Camera(28.4, 83.9, 10010.0, 10.0, 80.0, 0.0);
        mSceneView.setViewpointCamera(camera);

        Viewpoint viewpoint = new Viewpoint(26.15, 107.315800, 1000000);
        mSceneView.setViewpoint(viewpoint);

    }

    @Override
    protected void onPause() {
        super.onPause();
        // pause SceneView
        mSceneView.pause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        // resume SceneView
        mSceneView.resume();
    }

    @Override protected void onDestroy() {
        super.onDestroy();
        // dispose SceneView
        mSceneView.dispose();
    }

    //返回主页
    public void returnMainActivty(View view){
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
    }
}